<!DOCTYPE html>
<html lang="zh">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script type="module">
        // 引入Observe，Ball类
        import {Observe,Ball} from './plugin.js'
        // 创建Ball类的实例
        let count = 1
        let timer = setInterval(()=>{
            let name = `ball_${count++}`
            name = new Ball()
            name.move('left',1200)
            name.event.eventDep('event1',function(){
            name.move('top',400)
        })
        name.event.eventDep('event2',function(){
            name.move('left',0)
        })
        name.event.eventDep('event3',function(){
            name.move('top',0)
        })
        //小球创建50个后关闭定时器，停止创建
        if(count===50)clearInterval(timer)
        },2000)
    </script>
</body>

</html>